import setting from '@/setting.js'

const state = {
  sidebar_width: setting.sidebar.width,
  // 搜索面板激活状态
  search_active: false,
  // 快捷键
  hotkey_open: setting.hotkey.search.open,
  hotkey_close: setting.hotkey.search.close,
}

const mutations = {
  SET_SETTING: (state, data) => {
    state.search_active = data
  },
  SET_SETTING_OPEN: (state) => {
    state.search_active = true
  },
  SET_SETTING_CLOSE: (state) => {
    state.search_active = false
  }
}

const actions = {
  setSearchActive({ commit }, data) {
    commit('SET_SETTING', data)
  },
  setSearchShow({ commit }) {
    commit('SET_SETTING_OPEN')
  },
  setSearchClose({ commit }) {
    commit('SET_SETTING_CLOSE')
  }
}

export default {
  namespaced: true,
  state,
  mutations,
  actions
}


